package com.rms.hkpc.model;

import com.rms.hkpc.callback.Callback;
import com.rms.hkpc.model.listener.OnResultListener;
import com.rms.hkpc.util.OKHttpUtil;

import java.lang.reflect.Type;

public class AddHocModel {

    public void update(Object bean, final OnResultListener listener, Type typeofT) {
        OKHttpUtil.getInstance().postAsync(OKHttpUtil.NET_URL + "/api/esp/workOrders/update", bean, new Callback() {
            @Override
            public void onSuccess(Object obj) {
                listener.onSuccess(obj);
            }

            @Override
            public void onFailed(Exception e) {
                listener.onFails(e);
            }
        }, typeofT);
    }

    public void create(Object bean, final OnResultListener listener, Type typeofT) {
        OKHttpUtil.getInstance().postAsync(OKHttpUtil.NET_URL + "/api/esp/workOrders/add", bean, new Callback() {
            @Override
            public void onSuccess(Object obj) {
                listener.onSuccess(obj);
            }

            @Override
            public void onFailed(Exception e) {
                listener.onFails(e);
            }
        }, typeofT);
    }
}
